package src.zhuzi.spring.ioc.base;

import java.io.IOException;
import java.util.Properties;

public class SimpleFactory {
	public static Weapon getWeapon(){
		Properties prop = new Properties();
		try {
			prop.load(SimpleFactory.class.getClassLoader().getResourceAsStream("system.properties"));
			String w = (String) prop.get("weapon");
			Weapon weapon = (Weapon) Class.forName(w).newInstance();
			return weapon;
		} catch (IOException e) {
			e.printStackTrace();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return null;
	}
//	return new Knife();
}